package com.pashanhoo.datastructure.leetcode;

/**
 * @author 胡庆安
 * @version V1.0
 * @Package com.pashanhoo.datastructure.leetcode
 * @date 2020/10/16 20:43
 * @Copyright © 2010-2020 爬山虎科技（扬州）股份有限公司
 */
//示例 1:
//输入: 123
//输出: 321
// 示例 2:
//输入: -123
//输出: -321
//示例 3:
//输入: 120
//输出: 21
public class Test7 {
    public static void main(String[] args) {

        int reverse = reverse(1534236469);

    }

    public static  int reverse(int x) {
        int number= x;
        int num;
        int sum = 0;
        while (number != 0) {
            num = number % 10;
            number = number / 10;
            sum = sum * 10 + num;
        }
        return sum;
    }

}
